:root {
    --primary-color: #8b5cf6;
    --primary-light: #a78bfa;
    --primary-dark: #7c3aed;
    --primary-bg: #f5f3ff;
    --primary-border: #ddd6fe;
    --sidebar-width: 280px;
    --sidebar-collapsed-width: 60px;
    --header-height: 60px;
    --chat-input-height: 120px;
    /* 代码相关变量 */
    --code-bg: #f3f4f6;
    --code-color: #7c3aed;
    --code-border: #e5e7eb;
    /* 数学公式变量 */
    --math-bg: #f8fafc;
    --math-color: #7c3aed;
    --math-border: #e5e7eb;
    /* 下拉框变量 - 浅色主题 */
    --select-bg: white;
    --select-color: #374151;
    --select-border: #e2e8f0;
    --select-hover-bg: #f8fafc;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    background-color: #f8fafc;
    margin: 0;
    padding: 0;
    overflow-x: hidden;
    min-height: 100vh;
}

/* 布局结构 */
.app-container {
    display: flex;
    height: 100vh;
    background-color: white;
}

/* 侧边栏样式 */
.sidebar {
    width: var(--sidebar-width);
    background-color: #f9fafb;
    border-right: 1px solid #e5e7eb;
    height: 100%;
    transition: all 0.3s ease;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.sidebar.collapsed {
    width: var(--sidebar-collapsed-width);
}

.sidebar-header {
    padding: 16px;
    border-bottom: 1px solid #e5e7eb;
    display: flex;
    align-items: center;
    justify-content: space-between;
    height: var(--header-height);
    min-height: var(--header-height);
}

.sidebar-content {
    flex: 1;
    overflow-y: auto;
    padding: 16px;
}

.sidebar-footer {
    padding: 16px;
    border-top: 1px solid #e5e7eb;
}

/* 新对话按钮 - 紫色主题 */
.sidebar-footer .btn-primary {
    background-color: var(--primary-color);
    border-color: var(--primary-color);
    color: white;
    font-weight: 500;
    transition: all 0.2s ease;
}

.sidebar-footer .btn-primary:hover {
    background-color: var(--primary-dark);
    border-color: var(--primary-dark);
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(139, 92, 246, 0.3);
}

.sidebar-footer .btn-primary:active {
    background-color: var(--primary-dark);
    border-color: var(--primary-dark);
    transform: translateY(0);
}

.sidebar-footer .btn-primary:focus {
    background-color: var(--primary-color);
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(139, 92, 246, 0.3);
}

/* 主聊天区域 */
.main-content {
    flex: 1;
    display: flex;
    flex-direction: column;
    height: 100%;
    transition: all 0.3s ease;
}

/* 聊天头部 - 修改后的布局 */
.chat-header {
    height: var(--header-height);
    padding: 0 24px;
    border-bottom: 1px solid #e5e7eb;
    display: flex;
    align-items: center;
    justify-content: space-between;
    background-color: white;
    gap: 16px;
}

/* 左侧：对话标题 + 模型标志 */
.chat-header .header-left {
    display: flex;
    align-items: center;
    flex-grow: 1;
}

/* 中间：状态指示器 + 模型选择器 */
.chat-header .header-center {
    display: flex;
    align-items: center;
    gap: 12px;
}

/* 右侧：用户头像 */
.chat-header .header-right {
    display: flex;
    align-items: center;
}

/* 聊天消息区域 - 限制对话内容在中间显示 */
.chat-messages {
    flex: 1;
    overflow-y: auto;
    padding: 24px;
    background-color: #f8fafc;
    display: flex;
    flex-direction: column;
}

/* 消息气泡 - 类似DeepSeek风格 */
.message {
    max-width: 100%;
    margin-bottom: 32px;
    display: flex;
    align-items: flex-start;
    position: relative;
}

.message.user {
    justify-content: flex-end;
}

.message-avatar {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: bold;
    margin: 0 12px;
    flex-shrink: 0;
}

.message.user .message-avatar {
    background-color: var(--primary-color);
    color: white;
}

.message.ai .message-avatar {
    background-color: #e5e7eb;
    color: #374151;
}

.message-content {
    padding: 16px 20px;
    border-radius: 12px;
    line-height: 1.6;
    word-wrap: break-word;
    flex: 1;
    min-width: 0;
    max-width: 800px;
    word-break: break-word;
    overflow-wrap: break-word;
    font-size: 16px;
    line-height: 1.7;
    position: relative;
}

/* 用户消息气泡 */
.message.user .message-content {
    background-color: var(--primary-color);
    color: white;
    border-radius: 18px 18px 4px 18px;
    box-shadow: 0 2px 8px rgba(139, 92, 246, 0.2);
}

/* AI消息无背景气泡 */
.message.ai .message-content {
    background-color: transparent;
    color: #374151;
    padding: 8px 20px;
    border: none;
    box-shadow: none;
}

/* 消息复制按钮 */
.message-copy-btn {
    position: absolute;
    top: 8px;
    right: 8px;
    background: rgba(255, 255, 255, 0.9);
    border: none;
    border-radius: 4px;
    padding: 4px 8px;
    font-size: 12px;
    color: #6b7280;
    cursor: pointer;
    opacity: 0;
    transition: all 0.2s ease;
    backdrop-filter: blur(10px);
}

.message.user .message-copy-btn {
    background: rgba(255, 255, 255, 0.2);
    color: rgba(255, 255, 255, 0.8);
}

.message:hover .message-copy-btn {
    opacity: 1;
}

.message-copy-btn:hover {
    background: rgba(255, 255, 255, 1);
    color: var(--primary-color);
}

.message.user .message-copy-btn:hover {
    background: rgba(255, 255, 255, 0.3);
    color: white;
}

/* 聊天输入区域 */
.chat-input-area {
    padding: 24px;
    background-color: white;
    display: flex;
    flex-direction: column;
    align-items: center;
}

.chat-input-container {
    width: 100%;
    max-width: 800px;
}

#user-input {
    width: 100%;
    height: var(--chat-input-height);
    border: 1px solid #e2e8f0;
    border-radius: 12px;
    padding: 16px;
    font-size: 16px;
    resize: none;
    box-sizing: border-box;
    margin-bottom: 12px;
    transition: all 0.2s ease;
}

#user-input:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(139, 92, 246, 0.1);
}

.chat-controls {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

#send-btn {
    padding: 10px 24px;
    background: var(--primary-color);
    color: white;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    font-size: 16px;
    display: flex;
    align-items: center;
    transition: all 0.2s ease;
}

#send-btn:hover {
    background: var(--primary-dark);
    transform: translateY(-1px);
}

#send-btn:disabled {
    background: #9ca3af;
    cursor: not-allowed;
    transform: none;
}

/* 历史对话列表 */
.conversation-list {
    list-style: none;
    padding: 0;
    margin: 0;
}

.conversation-item {
    position: relative;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px;
    border-radius: 8px;
    margin-bottom: 8px;
    cursor: pointer;
    transition: background-color 0.2s;
}

.conversation-content {
    flex: 1;
    display: flex;
    align-items: center;
    min-width: 0;
}

.conversation-item:hover {
    background-color: #e5e7eb;
}

.conversation-item.active {
    background-color: var(--primary-bg);
    border: 1px solid var(--primary-border);
}

.conversation-title {
    font-weight: 500;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    flex: 1;
    margin-right: 8px;
    font-size: 14px;
}

.conversation-time {
    font-size: 12px;
    color: #6b7280;
    white-space: nowrap;
}

.sidebar.collapsed .conversation-title,
.sidebar.collapsed .conversation-time {
    display: none;
}

/* 删除按钮样式 */
.delete-conversation-btn {
    background: none;
    border: none;
    color: #6b7280;
    padding: 4px 6px;
    border-radius: 4px;
    cursor: pointer;
    opacity: 0;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 14px;
}

.delete-conversation-btn:hover {
    background-color: #f8f9fa;
    color: #dc3545;
}

/* 鼠标悬停时显示删除按钮 */
.conversation-item:hover .delete-conversation-btn {
    opacity: 1;
}

/* 移动端适配 */
@media (max-width: 768px) {
    .delete-conversation-btn {
        opacity: 1;
        background-color: rgba(0, 0, 0, 0.05);
    }

    .conversation-item {
        padding: 10px 12px;
    }
}

/* 活跃状态的对话项始终显示删除按钮 */
.conversation-item.active .delete-conversation-btn {
    opacity: 1;
}

/* 侧边栏折叠状态下的删除按钮处理 */
.sidebar.collapsed .delete-conversation-btn {
    display: none;
}

.sidebar.collapsed .conversation-item {
    justify-content: center;
    padding: 12px;
}

/* 用户信息边栏样式 */
.user-sidebar {
    position: fixed;
    top: 0;
    right: -400px;
    width: 400px;
    height: 100%;
    background-color: white;
    box-shadow: -2px 0 10px rgba(0, 0, 0, 0.1);
    transition: right 0.3s ease;
    z-index: 1000;
    overflow-y: auto;
}

.user-sidebar.open {
    right: 0;
}

.user-sidebar-header {
    padding: 16px 24px;
    border-bottom: 1px solid #e5e7eb;
    display: flex;
    align-items: center;
    justify-content: space-between;
    background-color: white;
}

.user-sidebar-content {
    padding: 24px;
    background-color: white;
}

.user-sidebar .user-avatar {
    background-color: var(--primary-color);
    color: white;
}

.user-sidebar .user-avatar:hover {
    background-color: var(--primary-dark);
}

.user-sidebar .card {
    background-color: white;
    border: 1px solid #e5e7eb;
}

.user-sidebar .card-body {
    background-color: white;
    color: #374151;
}

.user-sidebar .card-title {
    color: #374151;
}

.user-sidebar .text-muted {
    color: #6b7280 !important;
}

.user-sidebar .btn-outline-primary {
    color: var(--primary-color);
    border-color: var(--primary-color);
}

.user-sidebar .btn-outline-primary:hover {
    background-color: var(--primary-color);
    border-color: var(--primary-color);
    color: white;
}

.overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.5);
    z-index: 999;
    display: none;
}

.overlay.active {
    display: block;
}

/* 状态指示器新位置 - 在下拉框左边并向右对齐 */
.status-indicator {
    font-size: 14px;
    padding: 4px 12px;
    border-radius: 16px;
    background-color: #f0fdf4;
    color: #16a34a;
    border: 1px solid #bbf7d0;
    white-space: nowrap;
    order: 1;
}

.status-indicator.error {
    background-color: #fef2f2;
    color: #dc2626;
    border-color: #fecaca;
}

.status-indicator.info {
    background-color: #eff6ff;
    color: #2563eb;
    border-color: #dbeafe;
}

.status-indicator.success {
    background-color: #f0fdf4;
    color: #16a34a;
    border-color: #bbf7d0;
}

/* 模型选择器样式 - 支持主题切换 */
.model-selector {
    min-width: 150px;
    order: 2;
}

.model-selector .form-select {
    font-size: 14px;
    padding: 6px 12px;
    border: 1px solid var(--select-border, #e2e8f0);
    border-radius: 8px;
    background-color: var(--select-bg, white);
    color: var(--select-color, #374151);
    cursor: pointer;
    transition: all 0.2s ease;
}

.model-selector .form-select:focus {
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(139, 92, 246, 0.1);
    background-color: var(--select-bg, white);
    color: var(--select-color, #374151);
}

.model-selector .form-select option {
    background-color: var(--select-bg, white);
    color: var(--select-color, #374151);
    padding: 8px;
}

/* 模型标签 */
.model-badge {
    font-size: 12px;
    padding: 4px 10px;
    border-radius: 16px;
    background-color: #f1f5f9;
    color: #475569;
    font-weight: 500;
}

.model-badge.deepseek {
    background-color: #ede9fe;
    color: var(--primary-dark);
}

.model-badge.baidu {
    background-color: #fdf4ff;
    color: #a855f7;
}

.model-badge.qwen {
    background: linear-gradient(135deg, #c4b5fd, #a78bfa);
    color: white;
}

/* 响应式设计 */
@media (max-width: 1200px) {
    .message-content {
        max-width: 700px;
    }

    .chat-input-container {
        max-width: 700px;
    }
}

@media (max-width: 768px) {
    .sidebar {
        position: fixed;
        left: 0;
        z-index: 1001;
        transform: translateX(-100%);
    }

    .sidebar.open {
        transform: translateX(0);
    }

    .user-sidebar {
        width: 100%;
        right: -100%;
    }

    .overlay.active {
        display: block;
    }

    .model-selector {
        display: none;
    }

    .message-content {
        max-width: 95%;
    }

    .chat-input-container {
        max-width: 95%;
    }

    .chat-header {
        padding: 0 16px;
        gap: 12px;
    }

    .header-center {
        gap: 8px;
    }

    .status-indicator {
        font-size: 12px;
        padding: 3px 8px;
    }

    .model-selector {
        min-width: 120px;
    }

    .model-selector .form-select {
        font-size: 13px;
        padding: 5px 10px;
    }
}

/* 其他样式 */
.toggle-sidebar {
    background: none;
    border: none;
    font-size: 20px;
    cursor: pointer;
    color: #6b7280;
    padding: 8px;
    border-radius: 4px;
    transition: all 0.2s ease;
}

.toggle-sidebar:hover {
    background-color: #e5e7eb;
    color: var(--primary-color);
}

.user-avatar {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background-color: var(--primary-color);
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: bold;
    cursor: pointer;
    transition: all 0.2s ease;
}

.user-avatar:hover {
    background-color: var(--primary-dark);
    transform: scale(1.05);
}

.typing-indicator {
    display: flex;
    align-items: center;
    color: #6b7280;
    font-size: 14px;
    margin-top: 8px;
}

.empty-state {
    text-align: center;
    padding: 40px 20px;
    color: #6b7280;
    max-width: 800px;
    width: 100%;
}

.empty-state i {
    font-size: 48px;
    margin-bottom: 16px;
    opacity: 0.5;
}

/* 浅色主题代码块样式 */
.code-block-wrapper {
    margin: 1em 0;
    border-radius: 12px;
    overflow: hidden;
    background: #f8f9fa;
    border: 1px solid #e9ecef;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.code-block-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px 16px;
    background: #e9ecef;
    border-bottom: 1px solid #dee2e6;
    font-family: 'Monaco', 'Menlo', 'Ubuntu Mono', monospace;
}

.code-language {
    color: #495057;
    font-size: 12px;
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.code-copy-btn {
    background: rgba(139, 92, 246, 0.1);
    border: 1px solid rgba(139, 92, 246, 0.3);
    color: var(--primary-color);
    padding: 6px 12px;
    border-radius: 6px;
    font-size: 12px;
    cursor: pointer;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    gap: 4px;
    font-family: 'Monaco', 'Menlo', 'Ubuntu Mono', monospace;
}

.code-copy-btn:hover {
    background: rgba(139, 92, 246, 0.2);
    border-color: rgba(139, 92, 246, 0.5);
    transform: translateY(-1px);
}

.code-copy-btn:disabled {
    background: rgba(76, 175, 80, 0.2);
    border-color: rgba(76, 175, 80, 0.3);
    color: #4CAF50;
    cursor: default;
}

.code-block-content {
    overflow-x: auto;
}

.code-block-content pre {
    margin: 0;
    padding: 16px;
    background: transparent !important;
    font-family: 'Monaco', 'Menlo', 'Ubuntu Mono', monospace;
    font-size: 13px;
    line-height: 1.5;
    color: #2d3748;
}

.code-block-content code {
    font-family: 'Monaco', 'Menlo', 'Ubuntu Mono', monospace;
    background: transparent !important;
    padding: 0 !important;
}

/* 浅色主题语法高亮颜色 */
.hljs {
    color: #2d3748;
    background: #f8f9fa !important;
}

.hljs-keyword { color: #805ad5; }
.hljs-built_in { color: #3182ce; }
.hljs-type { color: #3182ce; }
.hljs-literal { color: #805ad5; }
.hljs-number { color: #dd6b20; }
.hljs-string { color: #dd6b20; }
.hljs-comment { color: #718096; }
.hljs-function { color: #3182ce; }
.hljs-params { color: #2d3748; }
.hljs-title { color: #3182ce; }
.hljs-variable { color: #2d3748; }
.hljs-attr { color: #dd6b20; }
.hljs-tag { color: #805ad5; }
.hljs-name { color: #805ad5; }
.hljs-meta { color: #718096; }
.hljs-symbol { color: #805ad5; }

/* 行内代码样式 - 支持主题切换 */
.inline-code {
    background: var(--code-bg, #f3f4f6);
    color: var(--code-color, #7c3aed);
    padding: 2px 6px;
    border-radius: 4px;
    font-size: 0.9em;
    font-family: 'Monaco', 'Menlo', 'Ubuntu Mono', monospace;
    border: 1px solid var(--code-border, #e5e7eb);
}

.message.ai .inline-code {
    background: var(--code-bg, #f3f4f6);
    color: var(--code-color, #7c3aed);
}

.message.user .inline-code {
    background: rgba(255, 255, 255, 0.15);
    color: #f0abfc;
    border: 1px solid rgba(255, 255, 255, 0.2);
}

/* 数学公式样式 - 紫色主题 */
.math-formula {
    background: var(--math-bg, #f8fafc);
    color: var(--math-color, #7c3aed);
    padding: 1px 4px;
    border-radius: 3px;
    font-family: 'Monaco', 'Menlo', 'Ubuntu Mono', monospace;
    border: 1px solid var(--math-border, #e5e7eb);
}

/* 表格容器 */
.table-container {
    overflow-x: auto;
    margin: 1em 0;
    border-radius: 8px;
    border: 1px solid #E5E7EB;
}

.table-container table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.9em;
}

.table-container th {
    background: #F8F9FA;
    font-weight: 600;
    padding: 12px;
    border: 1px solid #E5E7EB;
    text-align: left;
}

.table-container td {
    padding: 12px;
    border: 1px solid #E5E7EB;
}

.table-container tr:nth-child(even) {
    background: #F8F9FA;
}

/* 流式消息光标动画 */
.message.ai.streaming .message-content::after {
    content: '▋';
    animation: blink 1s infinite;
    color: var(--primary-color);
    margin-left: 2px;
    font-weight: bold;
}

@keyframes blink {
    0%, 50% { opacity: 1; }
    51%, 100% { opacity: 0; }
}

/* 对话项信息布局 */
.conversation-info {
    flex: 1;
    min-width: 0;
}

.conversation-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 4px;
}

.conversation-title {
    flex: 1;
    font-weight: 500;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    margin-right: 8px;
}

.conversation-model-badge {
    font-size: 10px;
    padding: 2px 8px;
    border-radius: 12px;
    background-color: #f1f5f9;
    color: #475569;
    white-space: nowrap;
    flex-shrink: 0;
}

.conversation-model-badge.deepseek {
    background-color: #ede9fe;
    color: var(--primary-dark);
}

.conversation-model-badge.baidu {
    background-color: #fdf4ff;
    color: #a855f7;
}

.conversation-model-badge.qwen {
    background: linear-gradient(135deg, #c4b5fd, #a78bfa);
    color: white;
}

.conversation-footer {
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.conversation-time {
    font-size: 11px;
    color: #6b7280;
}

/* 侧边栏折叠状态 */
.sidebar.collapsed .conversation-info,
.sidebar.collapsed .conversation-model-badge,
.sidebar.collapsed .conversation-time {
    display: none;
}

.sidebar.collapsed .conversation-item {
    justify-content: center;
    padding: 12px;
}

.sidebar.collapsed .conversation-content {
    justify-content: center;
}

/* 系统设置模态框样式 */
.settings-modal .modal-content {
    background-color: white;
    color: #374151;
}

.settings-modal .modal-header {
    border-bottom: 1px solid #e5e7eb;
    background-color: white;
}

.settings-modal .modal-footer {
    border-top: 1px solid #e5e7eb;
    background-color: white;
}

.settings-modal .nav-tabs {
    border-bottom: 1px solid #dee2e6;
    background-color: white;
}

.settings-modal .nav-link {
    color: #6c757d;
    border: none;
    padding: 0.75rem 1.5rem;
    background-color: transparent;
}

.settings-modal .nav-link.active {
    color: var(--primary-color);
    background: none;
    border-bottom: 2px solid var(--primary-color);
}

.settings-modal .tab-content {
    padding: 1.5rem 0;
    min-height: 300px;
    background-color: white;
}

.settings-modal .form-control {
    background-color: white;
    border-color: #d1d5db;
    color: #374151;
}

.settings-modal .form-control:focus {
    background-color: white;
    border-color: var(--primary-color);
    color: #374151;
    box-shadow: 0 0 0 3px rgba(139, 92, 246, 0.1);
}

.settings-modal .form-check-input:checked {
    background-color: var(--primary-color);
    border-color: var(--primary-color);
}

.settings-modal .btn-primary {
    background-color: var(--primary-color);
    border-color: var(--primary-color);
}

.settings-modal .btn-primary:hover {
    background-color: var(--primary-dark);
    border-color: var(--primary-dark);
}

.settings-modal .alert-warning {
    background-color: #fffbeb;
    border-color: #fcd34d;
    color: #92400e;
}

/* 系统设置模态框中的下拉框样式 */
.settings-modal .form-select {
    background-color: var(--select-bg, white);
    color: var(--select-color, #374151);
    border-color: var(--select-border, #d1d5db);
}

.settings-modal .form-select:focus {
    background-color: var(--select-bg, white);
    color: var(--select-color, #374151);
    border-color: var(--primary-color);
}

/* 深色主题样式 */
body.dark-theme {
    background-color: #1a1a1a;
    color: #e9ecef;
    /* 深色主题代码变量 */
    --code-bg: #374151;
    --code-color: #a78bfa;
    --code-border: #4b5563;
    /* 深色主题数学公式变量 */
    --math-bg: #374151;
    --math-color: #c4b5fd;
    --math-border: #4b5563;
    /* 深色主题下拉框变量 */
    --select-bg: #2d2d2d;
    --select-color: #e9ecef;
    --select-border: #404040;
    --select-hover-bg: #374151;
}

body.dark-theme .app-container {
    background-color: #1a1a1a;
}

body.dark-theme .sidebar {
    background-color: #2d2d2d;
    border-right-color: #404040;
    color: #e9ecef;
}

body.dark-theme .sidebar-header,
body.dark-theme .sidebar-footer {
    border-color: #404040;
}

/* 深色主题新对话按钮 */
body.dark-theme .sidebar-footer .btn-primary {
    background-color: var(--primary-color);
    border-color: var(--primary-color);
    color: white;
}

body.dark-theme .sidebar-footer .btn-primary:hover {
    background-color: var(--primary-dark);
    border-color: var(--primary-dark);
    box-shadow: 0 4px 12px rgba(139, 92, 246, 0.5);
}

body.dark-theme .chat-header {
    background-color: #2d2d2d;
    border-bottom-color: #404040;
    color: #e9ecef;
}

body.dark-theme .chat-messages {
    background-color: #1a1a1a;
}

body.dark-theme .message.ai .message-content {
    background-color: transparent;
    color: #e9ecef;
}

body.dark-theme .message.user .message-content {
    background-color: var(--primary-color);
    color: white;
}

body.dark-theme .chat-input-area {
    background-color: #2d2d2d;
}

body.dark-theme #user-input {
    background-color: #2d2d2d;
    border-color: #404040;
    color: #e9ecef;
}

body.dark-theme .form-control {
    background-color: #2d2d2d;
    border-color: #404040;
    color: #e9ecef;
}

body.dark-theme .form-control:focus {
    background-color: #2d2d2d;
    border-color: var(--primary-color);
    color: #e9ecef;
}

body.dark-theme .conversation-item:hover {
    background-color: #404040;
}

body.dark-theme .conversation-item.active {
    background-color: #3a3a5c;
}

body.dark-theme .empty-state {
    color: #a0a0a0;
}

body.dark-theme .inline-code {
    background: var(--code-bg, #374151) !important;
    color: var(--code-color, #a78bfa) !important;
    border-color: var(--code-border, #4b5563) !important;
}

body.dark-theme .math-formula {
    background: var(--math-bg, #374151) !important;
    color: var(--math-color, #c4b5fd) !important;
    border-color: var(--math-border, #4b5563) !important;
}

body.dark-theme .message-content blockquote {
    background-color: #2d2d2d;
    color: #a0a0a0;
    border-left-color: var(--primary-color);
}

body.dark-theme .message-content table th {
    background-color: #2d2d2d;
    border-color: #404040;
    color: #e9ecef;
}

body.dark-theme .message-content table td {
    border-color: #404040;
    color: #e9ecef;
}

body.dark-theme .message-content table tr:nth-child(even) {
    background-color: #2d2d2d;
}

body.dark-theme .message-content table tr:hover {
    background-color: #404040;
}

/* 深色主题代码块样式 */
body.dark-theme .code-block-wrapper {
    background: #2d2d2d;
    border: 1px solid #404040;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
}

body.dark-theme .code-block-header {
    background: #404040;
    border-bottom: 1px solid #4a4a4a;
}

body.dark-theme .code-language {
    color: #A9B7C6;
}

body.dark-theme .code-copy-btn {
    background: rgba(139, 92, 246, 0.2);
    border: 1px solid rgba(139, 92, 246, 0.4);
    color: var(--primary-light);
}

body.dark-theme .code-copy-btn:hover {
    background: rgba(139, 92, 246, 0.3);
    border-color: rgba(139, 92, 246, 0.6);
}

body.dark-theme .code-block-content pre {
    color: #D4D4D4;
}

/* 深色主题语法高亮 */
body.dark-theme .hljs {
    color: #D4D4D4;
    background: #2d2d2d !important;
}

body.dark-theme .hljs-keyword { color: #a78bfa; }
body.dark-theme .hljs-built_in { color: #7dd3fc; }
body.dark-theme .hljs-type { color: #7dd3fc; }
body.dark-theme .hljs-literal { color: #a78bfa; }
body.dark-theme .hljs-number { color: #fdba74; }
body.dark-theme .hljs-string { color: #fdba74; }
body.dark-theme .hljs-comment { color: #9ca3af; }
body.dark-theme .hljs-function { color: #7dd3fc; }
body.dark-theme .hljs-params { color: #D4D4D4; }
body.dark-theme .hljs-title { color: #7dd3fc; }
body.dark-theme .hljs-variable { color: #D4D4D4; }
body.dark-theme .hljs-attr { color: #fdba74; }
body.dark-theme .hljs-tag { color: #a78bfa; }
body.dark-theme .hljs-name { color: #a78bfa; }
body.dark-theme .hljs-meta { color: #9ca3af; }
body.dark-theme .hljs-symbol { color: #a78bfa; }

/* 深色主题下拉框样式 */
body.dark-theme .model-selector .form-select {
    background-color: var(--select-bg, #2d2d2d);
    color: var(--select-color, #e9ecef);
    border-color: var(--select-border, #404040);
}

body.dark-theme .model-selector .form-select:focus {
    background-color: var(--select-bg, #2d2d2d);
    color: var(--select-color, #e9ecef);
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(139, 92, 246, 0.2);
}

body.dark-theme .model-selector .form-select option {
    background-color: var(--select-bg, #2d2d2d);
    color: var(--select-color, #e9ecef);
}

/* 下拉框悬停效果 */
body.dark-theme .model-selector .form-select option:hover {
    background-color: var(--select-hover-bg, #374151) !important;
}

/* 深色主题系统设置模态框下拉框 */
body.dark-theme .settings-modal .form-select {
    background-color: var(--select-bg, #1a1a1a);
    color: var(--select-color, #e9ecef);
    border-color: var(--select-border, #404040);
}

body.dark-theme .settings-modal .form-select:focus {
    background-color: var(--select-bg, #1a1a1a);
    color: var(--select-color, #e9ecef);
    border-color: var(--primary-color);
}

body.dark-theme .settings-modal .form-select option {
    background-color: var(--select-bg, #1a1a1a);
    color: var(--select-color, #e9ecef);
}

/* 深色主题状态指示器 */
body.dark-theme .status-indicator {
    background-color: #064e3b;
    color: #6ee7b7;
    border-color: #059669;
}

body.dark-theme .status-indicator.error {
    background-color: #7f1d1d;
    color: #fca5a5;
    border-color: #dc2626;
}

body.dark-theme .status-indicator.info {
    background-color: #1e3a8a;
    color: #93c5fd;
    border-color: #2563eb;
}

body.dark-theme .status-indicator.success {
    background-color: #064e3b;
    color: #6ee7b7;
    border-color: #059669;
}

/* 深色主题模态框 */
body.dark-theme .settings-modal .modal-content {
    background-color: #2d2d2d;
    color: #e9ecef;
    border: 1px solid #404040;
}

body.dark-theme .settings-modal .modal-header {
    border-bottom-color: #404040;
    background-color: #2d2d2d;
}

body.dark-theme .settings-modal .modal-footer {
    border-top-color: #404040;
    background-color: #2d2d2d;
}

body.dark-theme .settings-modal .nav-tabs {
    border-bottom-color: #404040;
    background-color: #2d2d2d;
}

body.dark-theme .settings-modal .nav-link {
    color: #a0a0a0;
    background-color: transparent;
}

body.dark-theme .settings-modal .nav-link.active {
    color: var(--primary-light);
    border-bottom-color: var(--primary-light);
}

body.dark-theme .settings-modal .tab-content {
    background-color: #2d2d2d;
}

body.dark-theme .settings-modal .form-control {
    background-color: #1a1a1a;
    border-color: #404040;
    color: #e9ecef;
}

body.dark-theme .settings-modal .form-control:focus {
    background-color: #1a1a1a;
    border-color: var(--primary-color);
    color: #e9ecef;
}

body.dark-theme .settings-modal .alert-warning {
    background-color: #422006;
    border-color: #854d0e;
    color: #fef3c7;
}

/* 深色主题按钮 */
body.dark-theme .btn-outline-primary {
    color: var(--primary-light);
    border-color: var(--primary-light);
}

body.dark-theme .btn-outline-primary:hover {
    background-color: var(--primary-color);
    border-color: var(--primary-color);
    color: white;
}

body.dark-theme .btn-outline-secondary {
    color: #9ca3af;
    border-color: #6b7280;
}

body.dark-theme .btn-outline-secondary:hover {
    background-color: #6b7280;
    border-color: #9ca3af;
    color: white;
}

/* 深色主题用户信息边栏 */
body.dark-theme .user-sidebar {
    background-color: #2d2d2d;
    box-shadow: -2px 0 10px rgba(0, 0, 0, 0.3);
}

body.dark-theme .user-sidebar-header {
    background-color: #2d2d2d;
    border-bottom-color: #404040;
    color: #e9ecef;
}

body.dark-theme .user-sidebar-content {
    background-color: #2d2d2d;
    color: #e9ecef;
}

body.dark-theme .user-sidebar .user-avatar {
    background-color: var(--primary-color);
    color: white;
}

body.dark-theme .user-sidebar .user-avatar:hover {
    background-color: var(--primary-dark);
}

body.dark-theme .user-sidebar .card {
    background-color: #1a1a1a;
    border-color: #404040;
}

body.dark-theme .user-sidebar .card-body {
    background-color: #1a1a1a;
    color: #e9ecef;
}

body.dark-theme .user-sidebar .card-title {
    color: #e9ecef;
}

body.dark-theme .user-sidebar .text-muted {
    color: #a0a0a0 !important;
}

body.dark-theme .user-sidebar .btn-outline-primary {
    color: var(--primary-light);
    border-color: var(--primary-light);
}

body.dark-theme .user-sidebar .btn-outline-primary:hover {
    background-color: var(--primary-color);
    border-color: var(--primary-color);
    color: white;
}

body.dark-theme .user-sidebar .btn-outline-primary.w-100 {
    color: var(--primary-light);
    border-color: var(--primary-light);
}

body.dark-theme .user-sidebar .btn-outline-primary.w-100:hover {
    background-color: var(--primary-color);
    border-color: var(--primary-color);
    color: white;
}

/* 用户信息边栏中的链接样式 */
.user-sidebar a {
    color: var(--primary-color);
    text-decoration: none;
}

.user-sidebar a:hover {
    color: var(--primary-dark);
}

body.dark-theme .user-sidebar a {
    color: var(--primary-light);
}

body.dark-theme .user-sidebar a:hover {
    color: white;
}

/* 用户信息边栏中的分割线 */
.user-sidebar .card + .mt-3 {
    border-top: 1px solid #e5e7eb;
    padding-top: 16px;
}

body.dark-theme .user-sidebar .card + .mt-3 {
    border-top-color: #404040;
}

/* 用户信息边栏中的按钮组间距 */
.user-sidebar .mt-3 {
    margin-top: 16px !important;
}

.user-sidebar .mt-3 + .mt-3 {
    margin-top: 12px !important;
}

/* 用户头像在边栏中的样式 */
.user-sidebar .user-avatar.mx-auto {
    background: linear-gradient(135deg, var(--primary-color), var(--primary-light));
    box-shadow: 0 4px 12px rgba(139, 92, 246, 0.3);
}

body.dark-theme .user-sidebar .user-avatar.mx-auto {
    background: linear-gradient(135deg, var(--primary-color), var(--primary-light));
    box-shadow: 0 4px 12px rgba(139, 92, 246, 0.5);
}

/* 用户信息文本样式 */
.user-sidebar h4 {
    color: #1f2937;
    margin-bottom: 8px;
}

body.dark-theme .user-sidebar h4 {
    color: #f9fafb;
}

.user-sidebar .text-center h4 {
    font-weight: 600;
}

.user-sidebar .text-center p {
    margin-bottom: 4px;
}

/* 账户信息卡片样式 */
.user-sidebar .card-title i {
    color: var(--primary-color);
}

body.dark-theme .user-sidebar .card-title i {
    color: var(--primary-light);
}

.user-sidebar .card-body small {
    color: #6b7280;
    font-size: 0.875rem;
}

body.dark-theme .user-sidebar .card-body small {
    color: #a0a0a0;
}

.user-sidebar .card-body p {
    color: #374151;
    margin-bottom: 0;
}

body.dark-theme .user-sidebar .card-body p {
    color: #e9ecef;
}

/* 退出登录按钮特殊样式 */

/* Markdown 渲染样式 */
.message-content h1,
.message-content h2,
.message-content h3,
.message-content h4,
.message-content h5,
.message-content h6 {
    margin: 1.2em 0 0.6em 0;
    font-weight: 600;
    line-height: 1.25;
}

.message-content h1 {
    font-size: 1.6em;
    border-bottom: 1px solid #eaecef;
    padding-bottom: 0.3em;
}

.message-content h2 {
    font-size: 1.4em;
    border-bottom: 1px solid #eaecef;
    padding-bottom: 0.3em;
}

.message-content h3 {
    font-size: 1.2em;
}

.message-content h4 {
    font-size: 1.1em;
}

.message-content p {
    margin: 0.8em 0;
    line-height: 1.6;
}

.message-content p:first-child {
    margin-top: 0;
}

.message-content p:last-child {
    margin-bottom: 0;
}

.message-content ul,
.message-content ol {
    margin: 0.8em 0;
    padding-left: 2em;
}

.message-content li {
    margin: 0.4em 0;
    line-height: 1.6;
}

.message-content blockquote {
    margin: 1em 0;
    padding: 0.8em 1em;
    background-color: #f8f9fa;
    border-left: 4px solid #dfe2e5;
    color: #6a737d;
    border-radius: 4px;
}

.message-content blockquote p {
    margin: 0;
}

.message-content table {
    border-collapse: collapse;
    width: 100%;
    margin: 1em 0;
    max-width: 100%;
    display: block;
    overflow-x: auto;
    white-space: nowrap;
}

.message-content table th,
.message-content table td {
    border: 1px solid #dfe2e5;
    padding: 0.6em 1em;
    text-align: left;
}

.message-content table th {
    background-color: #f6f8fa;
    font-weight: 600;
}

.message-content table tr:nth-child(even) {
    background-color: #f6f8fa;
}

/* 深色主题Markdown样式 */
body.dark-theme .message-content h1,
body.dark-theme .message-content h2 {
    border-bottom-color: #404040;
}

body.dark-theme .message-content blockquote {
    background-color: #2d2d2d;
    border-left-color: var(--primary-color);
    color: #a0a0a0;
}

body.dark-theme .message-content table th,
body.dark-theme .message-content table td {
    border-color: #404040;
}

body.dark-theme .message-content table th {
    background-color: #2d2d2d;
}

body.dark-theme .message-content table tr:nth-child(even) {
    background-color: #2d2d2d;
}

/* 停止指示器样式 */
.stop-indicator {
    margin-top: 10px;
    padding-top: 10px;
    border-top: 1px dashed #dee2e6;
}

/* 停止按钮样式 */
.btn-warning {
    background-color: #f59e0b;
    border-color: #f59e0b;
    color: #212529;
}

.btn-warning:hover {
    background-color: #d97706;
    border-color: #d97706;
}